#ifndef __DOUBLELINK_H__
#define __DOUBLELINK_H__
#include<stddef.h>

using ElementType=int;

class Doublelink
{
public:
    Doublelink();
    void InsertTail(const ElementType&element);
    void show();
    void ReserveShow();
    void InsertHead(const ElementType&element);
    size_t Size();
    void RemoveByIndex(int index);

    void InsertByIndex(int index,const ElementType&element);
    void RemoveByElement(const ElementType&element);
    void UpdateByElement(const ElementType&oldv,const ElementType&newv);
    ElementType&operator[](int index);
    size_t FindByElement(const ElementType &element);
    void FastSort();
    Doublelink  Merge(const Doublelink&link);



private:
    struct Node
    {
        Node(const ElementType&element):value(element),next(nullptr),prev(nullptr){}

        ElementType value;
        size_t size;
        Node*next;
        Node*prev;
    };
    void FastSort1(Node *start, Node *end);
    Node*head;//头指针
    Node*tail;//位指针
    size_t size;
};






















#endif